﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lamex.SIESystemManager.Calculate
{
    public class C_D31
    {
        public double GetD31(string W1, string W2,string n)
        {
            double TD31 = 0,Tn=0, Tw1 = 0, Tw2 = 0;
            Tw1 = double.Parse(string.IsNullOrEmpty(W1) ? "0" : W1);
            Tw2 = double.Parse(string.IsNullOrEmpty(W2) ? "0" : W2);
            Tn = double.Parse(string.IsNullOrEmpty(n) ? "0" : n);
            if (Tn != 0)
            {
                if (NumMAX(Tw1, Tw2) <= 1200)
                {
                    TD31 = ((70 * Tn) + 94) / 5;
                }
                else if (NumMAX(Tw1, Tw2) <= 1600)
                {
                    TD31 = ((70 * Tn) + 102) / 4;
                }
                else
                {
                    TD31 = ((70 * Tn) + 109) / 3;
                }
            }
            return TD31;
        }
        private static double NumMAX(double Tw1, double Tw2)
        {
            if (Tw1 > Tw2)
            {
                return Tw1;
            }
            return Tw2;
        }
    }
}
